package com.ruoyi.system.api.factory;

import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.RemoteSysUserService;
import com.ruoyi.system.api.domain.SysUser;

/**
 * 用户信息微服务降级处理
 * 
 * @author ruoyi
 * @date 2023-04-27
 */
@Component
public class RemoteSysUserFallbackFactory implements FallbackFactory<RemoteSysUserService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteSysUserFallbackFactory.class);

    @Override
    public RemoteSysUserService create(Throwable throwable)
    {
        log.error("用户信息服务调用失败:" + throwable.getMessage(), throwable);
        return new RemoteSysUserService()
        {
            @Override
            public R<SysUser> selectSysUserByUserId(Long userId, String source) {
                return null;
            }

            @Override
            public R<List<SysUser>> selectSysUserList(SysUser sysUser, String source) {
                return null;
            }

            @Override
            public R<Integer> insertSysUser(SysUser sysUser, String source) {
                return null;
            }

            @Override
            public R<Integer> updateSysUser(SysUser sysUser, String source) {
                return null;
            }

            @Override
            public R<Integer> deleteSysUserByUserIds(Long[] userIds, String source) {
                return null;
            }
        };

    }
}
